﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using Anytao.ISpace.BLL;
using Anytao.ISpace.DAL;
using Anytao.ISpace.Entity;

public partial class Talk_ToTalk : System.Web.UI.Page
{
    TalkBLL bll = new TalkBLL();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Bind();
        }
    }

    private void Bind()
    {
        dlTalkContent.DataSource = bll.GetAllTalksByTime();
        dlTalkContent.DataBind();
    }

    protected void btnToTalk_Click(object sender, EventArgs e)
    {
        Talk tmpTalk = new Talk();
        tmpTalk.Content = txtTalk.Text;
        tmpTalk.UserID = 1;
        tmpTalk.PostTime = DateTime.Now;

        bll.Insert(tmpTalk);

        txtTalk.Text = "";

        Bind();
    }
}
